﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TEST : MonoBehaviour {

    public GameObject aaa;

    public void Test()
    {
        Testttt();
    }

    public IEnumerator GroundFlip()
    {
        foreach (var cube in MapData.Instance.Cubes)
        {
            foreach(var surf in cube.Value.Surfaces)
            {
                foreach(var dice in surf.Value.Dices)
                {
                    dice.Value.Controller.Flip();
                    yield return new WaitForSeconds(0.1f);
                }
            }
        }
    }

    void TestR()
    {
        List<GameObject> list = new List<GameObject>();
        list.Add(Instantiate(aaa,Vector3.zero,Quaternion.identity,MapManager.Instance.transform));
        Destroy(list[0]);
        Debug.LogError(list.Count);
        Debug.LogError(list[0]);
        Debug.LogError(list[0].activeSelf);
    }

    public IEnumerator Tessst()
    {
        List<GameObject> list = new List<GameObject>();
        list.Add(Instantiate(aaa, Vector3.zero, Quaternion.identity, MapManager.Instance.transform));
        Destroy(list[0]);
        Debug.LogError(list.Count);
        Debug.LogError(list[0]);
        Debug.LogError(list[0].activeSelf);
        yield return new WaitForSeconds(1f);
        Debug.LogError(list.Count);
        if(list[0])
        Debug.LogError(!list[0]);
        Debug.LogError(list[0].activeSelf);
    }

    private void TestQua()
    {
        StartCoroutine(RotateBase.FaceTo(aaa, Vector3.back));
    }

    private void Testttt()
    {
        foreach(var cube in MapData.Instance.Cubes)
        {
            foreach(var suf in cube.Value.Surfaces)
            {
                foreach(var dice in suf.Value.Dices)
                {
                    dice.Value.Controller.CanFlip();
                }
            }
        }
    }
}
